import torch

a = torch.rand(2, 2)

print(a)
print(torch.mean(a)) # 均值
print(torch.sum(a)) # 求和
print(torch.prod(a)) # 累积
# print(torch.sum(a))
# print(torch.sum(a))

# 可以通过此方法降维
print(torch.mean(a, dim=1)) # 均值
print(torch.argmax(a, dim=1)) # max索引
print(torch.argmin(a, dim=1)) # min

# 直方图
a = torch.rand(2, 2) * 10
print(a)
# 统计6个区间，最大值最小值对应a中maxmin（因为是00）
print(torch.histc(a, 6, 0, 0))

# bincount
a = torch.randint(0, 10, [20])
print(a)
print(torch.bincount(a)) # 只支持一维
